package com.benmei.weike.dao;

import com.benmei.weike.dto.TdNtInviteByCode;
import com.benmei.weike.dto.TdNtMemberInvite;
import com.benmei.weike.dto.TdNtMemberRegister;
import com.benmei.weike.entity.Assistant;
import com.benmei.weike.entity.MemberResister;
import com.nativetalk.bean.member.TdNtMember;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

@Mapper
@Component
public interface TdNtMemberDao {

	/**
	 * @Purpose  根据token查找用户信息
	 * @version  4.1
	 * @author   wangzheng
	 * @param    token
	 * @return   TdNtMember
	 */
	public TdNtMember findTdNtMemberByToken(String token);

    TdNtMember getById(Integer memb_id);

	void updateBalance(TdNtMember tdNtMember);

	/**
	 * 根据用户openID查询用户信息
	 * @param openId
	 * @return
	 */
	public TdNtMember findTdNtMemberByOpenId(String openId);

	/**
	 * 小程序注册用户信息
	 * @param memberResister
	 * @return
	 */
	public Integer insertTdNtMember(MemberResister memberResister);

	/**
	 * @Purpose  添加用户
	 * @version  1.0
	 * @author   lizhun
	 * @param    tdNtMemberRegister
	 * @return   void
	 */
	public int insertTdNtMemberByWeb(TdNtMemberRegister tdNtMemberRegister);

	/**
	 * 根据手机号查询用户是否存在
	 * @param memb_phone
	 * @return
	 */
	public TdNtMember findTdNtMemberRegisterSms(String memb_phone);

	public Integer updateOpenId(@Param("open_id") String open_id,@Param("memb_id") Integer memb_id);

	/**
	 * 判断用户有没有预约过老师
	 * @param memb_id
	 * @return
	 */
	public Integer findUserBuyCourse(@Param("memb_id") Integer memb_id);

	/**
	 * @Purpose  根据邀请码查找用户(用于查看邀请码是否正确 只查询id,余额)
	 * @version  1.0
	 * @author   lizhun
	 * @param    invite_code
	 * @return   TdNtMemberInvite
	 */
	public TdNtMemberInvite findTdNtMemberInvite(String invite_code);

	/**
	 * @Purpose  根据用户手机号查找用户信息
	 * @version  1.0
	 * @author   lizhun
	 * @param    memb_phone
	 * @return   TdNtMember
	 */
	public TdNtMember findTdNtMemberByPhone(String memb_phone);


	public void insertInviteByCode(TdNtInviteByCode tdNtInviteByCode);

	public Integer findUseReservePackage(@Param("memb_id") Integer memb_id);

	Assistant findAssistantForMinMembSize();

	void assistantToMemb(@Param("memb_id")Integer memb_id, @Param("id")String id, @Param("name")String name);

	void updateAssistantStudentSizePlus(@Param("id")String id);
}
